package fun.zerone.service.order.dao.order;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import fun.zerone.service.order.entity.order.Order;
import fun.zerone.service.order.mapper.order.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by XQL on 2021/4/15.
 */
@Component
public class OrderDao {

    @Autowired
    private OrderMapper orderMapper;

    public Order findByOrderNo(String orderNo) {
        LambdaQueryWrapper<Order> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(Order::getOrderNo, Order::getUserId, Order::getTotalAmount);
        wrapper.eq(Order::getOrderNo, orderNo);
        return orderMapper.selectOne(wrapper);
    }

}
